/**
 * Copyright (c) Enalean, 2018. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

@import '../../../../../../src/www/themes/common/tlp/src/scss/variables/colors/common-colors';

.old-color-picker-preview {
    width: 16px;
    height: 16px;
    border: 0;
    vertical-align: middle;
}

.colorpicker-transparent-preview {
    margin: 0 5px 0 0;
    cursor: pointer;

    + .old-colorpicker-no-color-label {
        cursor: pointer;
    }
}

.old-color-preview {
    display: flex;
    margin: 10px 10px 5px;
}

.colorpicker-row {
    line-height: 0;
    text-align: center;

    > .colorpicker-circular-color:first-child {
        margin: 12px 12px 14px 0;
    }

    > .colorpicker-circular-color:last-child {
        margin: 12px 0 14px 12px;
    }
}

.colorpicker-row-no-color {
    display: flex;
    align-items: center;
    padding: 0 0 0 12px;

    > .colorpicker-circular-no-color {
        margin-bottom: 12px;
        border: 3px solid #d8d8d8;
        background: linear-gradient(
                135deg,
                #ffffff 44%,
                #d8d8d8 45%,
                #d8d8d8 55%,
                #ffffff 56%
        );

        &.colorpicker-no-color-selected {
            background: linear-gradient(
                    135deg,
                    #ffffff 50%,
                    #ffffff 50%
            );
            color: #d8d8d8;
        }
    }

    > .colorpicker-row-no-color-label {
        display: inline-block;
        position: relative;
        top: 1px;
        color: #787878;
        font-size: 12px;
        cursor: pointer;

        &:hover {
            color: darken(#787878, 20%);
        }
    }
}

.old-colorpicker-palette {
    width: 250px;
    margin: 10px 10px 0;
}

.colorpicker-squared-shade {
    content: ' ';
    height: 15px;
    padding: 0;
    border: 1px solid #000000;
    cursor: pointer;
}

.colorpicker-circular-color {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin: 12px 12px 14px;
    border-radius: 50%;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
}

.colorpicker-circular-color::before {
    display: inline-block;
    position: relative;
    top: 1px;
}

@each $color-name, $colors in $tlp-swatch-color-map {
    .colorpicker-circular-color-#{$color-name} {
        border: 3px solid map-get($colors, 'primary');
        background-color: map-get($colors, 'secondary');
        color: map-get($colors, 'primary');
    }

    &.color-picker-preview-#{$color-name} {
        display: inline-block;
        width: 16px;
        height: 16px;
        margin: 0;
        background-color: map-get($colors, 'primary');
        vertical-align: middle;
    }
}

.colorpicker-switch {
    margin: 5px 0 0;
    padding: 10px 10px 5px;
    border-top: 1px solid #ededed;
    text-align: center;
}

.colorpicker-switch-to-old-palette {
    max-width: 140px;
}

.colorpicker-switch-disabled {
    color: #8f8f8f;
    cursor: not-allowed;

    &:hover,
    &:link,
    &:active,
    &:visited {
        color: #8f8f8f;
        text-decoration: none;
    }
}
